package org.thread.test05.demo02;

/**
 * @author ZJL
 * @date 2025-03-11
 */
public class TicketThread1 extends Thread {
    private int ticket = 50;

    @Override
    public void run() {
        while (true) {
            if (ticket == 0) {
                System.out.println("票卖完了！");
                break;
            }
            ticket--;
            System.out.println(Thread.currentThread().getName() + "卖出了一张票，还剩" + (ticket) + "票！");

        }
    }
}
